package com.lvjunxiong.serviceinterface;

import com.lvjunxiong.serviceinterface.tongxun.Tongxun_twoListModel;

import java.util.Comparator;

/**
 * 汉字拼音排序比较器
	 */
  public class SpellComparatorName implements Comparator<Tongxun_twoListModel> {
	 public int compare(Tongxun_twoListModel o1, Tongxun_twoListModel o2) {
	  try {
	   // 取得比较对象的汉字编码，并将其转换成字符串
	   String s1 = new String(o1.getName().toString().getBytes("GB2312"), "ISO-8859-1");
	   String s2 = new String(o2.getName().toString().getBytes("GB2312"), "ISO-8859-1");
	   // 运用String类的 compareTo（）方法对两对象进行比较
	   return s1.compareTo(s2);
	  } catch (Exception e) {
	   e.printStackTrace();
	  }
	  return 0;
	 }
}